import java.util.Random;
import java.util.Scanner;

public class ketext {
    public static void main(String[] args) {
        System.out.println("游戏开始了");
        System.out.println("预备,剪刀石头布!");
        int count = 0;
        for (int i = 0; i < 5; i++) {
            System.out.println("你要出什么呢");
            Scanner sc = new Scanner(System.in);
            String game = sc.next();
            System.out.println(game);
            int e = 0;
            if(game.equals("剪刀")){
                e = 1;
            }else if(game.equals("石头")){
                e = 2;
            }else if(game.equals("布")){
                e = 3;
            }else{
                System.out.println("输入错误,无法识别");
                continue;
            }
            Random r = new Random();
            int j = r.nextInt(3);
            j += 1;
            if (j == 1) {
                System.out.println("电脑出的剪刀");
            } else if (j == 2) {
                System.out.println("电脑出的石头");
            } else if (j == 3) {
                System.out.println("电脑出的布");
            }
            int score = Game(j,e);
            if(score==1){
                System.out.println("你赢了");
            }else if(score==-1){
                System.out.println("你输了");
            } else if (score==0) {
                System.out.println("平局");
            }
            count +=score;
        }
        if(count>0){
            System.out.println("孩子,你赢了");
        }else if(count==0){
            System.out.println("平局!");
        } else if (count<0) {
            System.out.println("孩子,你输了");
        }
    }
    public static int Game(int user1,int user2){
        int win =-1;
        if(user1==1 && user2==2){
            win = 1;
        }else if(user1==2 && user2==3){
            win = 1;
        }else if(user1==3 && user2==1){
            win = 1;
        }else if(user1==user2){
            win = 0;
        }
        return win;
    }
}
